//
//  InitiationFailViewController.m
//  Molian
//
//  Created by xiaocankeji on 16/1/29.
//  Copyright © 2016年 xiaocan. All rights reserved.
//

#import "InitiationFailViewController.h"
#import "InitiationApplyViewController.h"
@implementation InitiationFailViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
     [self.navigationItem setHidesBackButton:YES animated:YES];
    self.navigationItem.rightBarButtonItem = nil;
    self.navigationItem.leftBarButtonItem = nil;
    self.title = @"入会审核";
    self.view.backgroundColor =  APPCOLORBACKGROUNDCOLOR(1);
    CGFloat h = DeviceWidth/320*180;
    UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, kNavigationBarHeight, DeviceWidth, h)];
   // v.backgroundColor = RGBA(55, 198, 119, 1);
    //    v.backgroundColor = RGBA(55, 149, 202, 1);
    //    v.backgroundColor = RGBA(244, 152, 68, 1);
    v.backgroundColor = RGBA(243, 93, 67, 1);
    [self.view addSubview:v];
    
    UIImageView *i = [[UIImageView alloc] initWithFrame:CGRectMake(DeviceWidth/2 - 50/2, 20, 50, 50)];
    i.image = [UIImage imageNamed:@"failure_icon"];
    [v addSubview:i];
    
    
    UILabel *l = [[UILabel alloc] initWithFrame:CGRectMake(10, 70, DeviceWidth - 20, h - 70)];
    l.numberOfLines = 0;
    l.textColor = [UIColor whiteColor];
    l.textAlignment = NSTextAlignmentCenter;
    l.font = kFont(15);
    l.text = @"您的资料审核失败\n无独团顾问会联系您协助您重新提交";
    [v addSubview:l];
    
    
    UIButton *downBt = [UIButton buttonWithType:UIButtonTypeCustom];
    downBt.frame = CGRectMake(0, DeviceHeight - 44, DeviceWidth, 44);
    downBt.backgroundColor = [UIColor whiteColor];
    [downBt setImage:[UIImage imageNamed:@"refresh_icon"] forState:UIControlStateNormal];
    [downBt setTitle:@"重新提交一次" forState:UIControlStateNormal];
    // [downBt setImageEdgeInsets:UIEdgeInsetsMake(-2,-18, -2, 0)];
    //[downBt setTitleEdgeInsets:UIEdgeInsetsMake(0, -12, 0, -10)];
    [downBt setTitleColor:APPCOLOR(1) forState:UIControlStateNormal];
    [downBt setTitleColor:RGBA(188, 188, 188, 1) forState:UIControlStateHighlighted];
    downBt.titleLabel.font = kFont(15);
    [downBt addTarget:self action:@selector(clickDownBt:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:downBt];

}
- (void)clickDownBt:(UIButton *)bt
{
    bt.enabled = NO;
    
    for (int i = 0; i<self.navigationController.viewControllers.count; i++) {
        
        if ([[self.navigationController.viewControllers objectAtIndex:i] isKindOfClass:[InitiationApplyViewController class]]) {
            [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:i] animated:YES];
        }
        
    }
   
    
    bt.enabled = YES;
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    if ([self isViewLoaded]&&!self.view.window) {
        self.view = nil;
    }
    // Dispose of any resources that can be recreated.
}
@end
